package com.ddfeiyu.service;

import com.ddfeiyu.annotation.EnableTraceLog;
import com.ddfeiyu.annotation.TraceLog;
import com.ddfeiyu.dto.UserDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.skywalking.apm.toolkit.trace.TraceContext;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@EnableTraceLog
public class UserServiceImpl implements UserService {

    @Override
    public void sayHello(UserDto userDto) {
        String traceId = TraceContext.traceId();
        log.info("---sayHello，traceId: [ {} ], userDto: [ {} ]", traceId, userDto);
    }

    @TraceLog(description = "打上日志TraceLog注解的日志")
    @Override
    public void sayHelloWithAnnotation(UserDto userDto) {
        String traceId = TraceContext.traceId();
        log.info("---sayHelloWithAnnotation，traceId: [ {} ], userDto: [ {} ]", traceId, userDto);
    }
}
